<!doctype html>
<html lang="en">
<head>
    @include('web.layout.head')
    <link rel="stylesheet" href="{{mix('/css/web/user/prove_information.css')}}">
    <script src="{{mix('/js/web/image/uploadPreview.min.js')}}"></script>
    <script src="{{mix('/js/web/user/seller_info.js')}}"></script>
    <script>
        jQuery.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': '{{csrf_token()}}'
            },
            error: function(jqXHR, textStatus, errorThrown){
                alert(jqXHR.status)
                if(jqXHR.status >= 500){
                    var msg = '服务器错误';
                }else if(jqXHR.status >= 400){
                    var msg = '路由错误或无权限';
                }else{
                    var msg = '未知错误';
                }

                layer.alert(msg, {
                    icon: 1
                }, function () {
                    location.reload();
                });
            }
        });
    </script>
</head>
<body>
@include('web.layout.header')
@include('web.layout.user_tab')
<div class="base_member_content">
    <div class="w1200">
       @include('web.layout.seller_nav')
        <div class="nav_right flr">
            <form id="frm-post"  action="{{asset('member/user/companymaterial/prove_save')}}" method="post" enctype="multipart/form-data" >
            <input type="hidden" name="company_id" value="<?php if(!empty($company_id)){echo $company_id;}?>" />
                <input type="hidden" name="company_material_id" value="<?php if(!empty($info['id'])){echo $info['id'];}?>" />
            <div class="marryreal">
                <h3>基本信息</h3>
                <div class="content">
                    <div class="hang">
                        <div class="name"><span class="red">*</span>公司名称</div>
                        <div class="nameright">
                            <div class="namedt"><?php if(!empty($company_name)){echo $company_name;}?></div>
                        </div>
                    </div>


                    <div class="hang top">
                        <div class="name"><span class="red">*</span>公司类型</div>
                        <div class="nameright">
                            <div class="namedt">
                                <li class="@if(!empty($info['ent_type']) and in_array('制造企业', json_decode($info['ent_type'],TRUE))){{'xuanzhong'}}@endif">制造企业</li>
                                <li class="@if(!empty($info['ent_type']) and in_array('分销代理商', json_decode($info['ent_type'],TRUE))){{'xuanzhong'}}@endif">分销代理商</li>
                                <li class="@if(!empty($info['ent_type']) and in_array('工程公司', json_decode($info['ent_type'],TRUE))){{'xuanzhong'}}@endif">工程公司</li>
                                <li class="@if(!empty($info['ent_type']) and in_array('系统集成商', json_decode($info['ent_type'],TRUE))){{'xuanzhong'}}@endif">系统集成商</li>
                                <li class="@if(!empty($info['ent_type']) and in_array('地产物业公司', json_decode($info['ent_type'],TRUE))){{'xuanzhong'}}@endif">地产物业公司</li>
                                <li class="@if(!empty($info['ent_type']) and in_array('事业单位', json_decode($info['ent_type'],TRUE))){{'xuanzhong'}}@endif">事业单位</li>
                                <li class="@if(!empty($info['ent_type']) and in_array('政府机关', json_decode($info['ent_type'],TRUE))){{'xuanzhong'}}@endif">政府机关</li>
                                <li class="@if(!empty($info['ent_type']) and in_array('其他', json_decode($info['ent_type'],TRUE))){{'xuanzhong'}}@endif">其他</li>

                            </div>
                            <input type="hidden" name="gongsileixing" value="<?php if(!empty($info['ent_type'])){ echo implode(',', json_decode($info['ent_type'],TRUE)); }?>" id="gsleixing">
                        </div>
                    </div>

                    <div class="hang top">
                        <div class="noxname">公司性质</div>
                        <div class="nameright">
                            <div class="namedt">
                                <select name="gongsixingzhi" style="margin-left: 3px;">
                                    @foreach($ent_property as $key => $item)
                                        <option @if(!empty($info['ent_property']) and $info['ent_property']==$key){{'selected'}}@endif value="{{$key}}">{{$item}}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="hang top">
                        <div class="name"><span class="red">*</span>员工人数</div>
                        <div class="nameright">
                            <div class="namedt">
                                <select id="gsrshu" name="yuangongrenshu">

                                    <option @if(!empty($info['ent_emp_number']) and $info['ent_emp_number']=='5人以下'){{'selected'}}@endif value="5人以下">5人以下</option>
                                    <option @if(!empty($info['ent_emp_number']) and $info['ent_emp_number']=='5-10人'){{'selected'}}@endif value="5-10人">5-10人</option>
                                    <option @if(!empty($info['ent_emp_number']) and $info['ent_emp_number']=='11-50人'){{'selected'}}@endif value="11-50人">11-50人</option>
                                    <option @if(!empty($info['ent_emp_number']) and $info['ent_emp_number']=='51-100人'){{'selected'}}@endif value="51-100人">51-100人</option>
                                    <option @if(!empty($info['ent_emp_number']) and $info['ent_emp_number']=='101-200人'){{'selected'}}@endif value="101-200人">101-200人</option>
                                    <option @if(!empty($info['ent_emp_number']) and $info['ent_emp_number']=='201-300人'){{'selected'}}@endif value="201-300人">201-300人</option>
                                    <option @if(!empty($info['ent_emp_number']) and $info['ent_emp_number']=='301-500人'){{'selected'}}@endif value="301-500人">301-500人</option>
                                    <option @if(!empty($info['ent_emp_number']) and $info['ent_emp_number']=='501-1000人'){{'selected'}}@endif value="501-1000人">501-1000人</option>
                                    <option @if(!empty($info['ent_emp_number']) and $info['ent_emp_number']=='1000人以上'){{'selected'}}@endif value="1000人以上">1000人以上</option>

                                </select>
                            </div>
                        </div>
                    </div>

                </div>
                <h3>经营信息</h3>
                <div class="content" style="min-height: auto">
                    <div class="hang top">
                        <div class="name"><span class="red">*</span>经营模式</div>
                        <div class="nameright">
                            <div class="namedtt">

                                <li class="@if(!empty($info['business_model']) and $info['business_model']=='生产厂家'){{'xuanzhongg'}}@endif" style="margin-left: 0px;">生产厂家</li>
                                <li class="@if(!empty($info['business_model']) and $info['business_model']=='经销批发'){{'xuanzhongg'}}@endif">经销批发</li>
                                <li class="@if(!empty($info['business_model']) and $info['business_model']=='商业服务'){{'xuanzhongg'}}@endif">商业服务</li>
                                <li class="@if(!empty($info['business_model']) and $info['business_model']=='招商代理'){{'xuanzhongg'}}@endif">招商代理</li>
                                <li class="@if(!empty($info['business_model']) and $info['business_model']=='其它'){{'xuanzhongg'}}@endif">其它</li>

                            </div>
                            <input type="hidden" name="jingyingmoshi" value="<?php if(!empty($info['business_model'])){echo $info['business_model']; } ?>" id="jymoshi">
                        </div>
                    </div>

                    <div class="hang top" style="overflow: visible;">
                        <div class="name"><span class="red">*</span>经营地址</div>
                        <div class="nameright">
                            <div class="namedtdz">
                                <?php if(!empty($business_address['regions'])){?>
                                    @include('web.layout.city', ['data' => implode('/', $business_address['regions'])])

                                <?php }else{?>
                                    @include('web.layout.city', ['data' => ''])
                                <?php } ?>
                                <input type="text" name="namedtdz_addr" placeholder="请输入详细地址" class="address fl" value="<?php if(!empty($business_address['addr'])){ echo $business_address['addr']; } ?>" />
                                <input type="hidden" name="namedtdz" value="<?php if(!empty($business_address['regions'])){?> {{implode(',', $business_address['regions'])}} <?php } ?>" />

                            </div>
                        </div>
                    </div>

                    <div class="clear"></div>
                    <div class="hang top">
                        <div class="name"><span class="red">*</span>主营行业</div>
                        <div class="nameright" style="position: relative;">
                            <div class="namedt01">
                                @if(!empty($business_trade))
                                    @foreach($business_trade as $key => $item)
                                        <li data-id="{{$item['name']}}" class="@if(!empty($info['business_trade']) and in_array($item['name'], json_decode($info['business_trade'],TRUE))){{'xuanzhong01'}}@endif" style="@if($key==0) {{'margin-left: 0px;'}}@endif">{{$item['name']}}</li>
                                    @endforeach
                                @endif
                            </div>
                            <div class="clear"></div>
                            <input type="hidden" name="zhuyinghangye" value="<?php if(!empty($info['business_trade_name'])){ echo  $info['business_trade_name']; } ?>" id="zyhangye">
                        </div>
                    </div>

                    <div class="hang top ">
                        <div class="name"><span class="red">*</span>主营产品</div>
                        <div class="nameright addcolumn">
                            @foreach($business_product as $item_list)
                                <div class="lastt">
                                    <div class="product" style="float: left;">
                                        <ul>
                                            @foreach($item_list as $key => $item)
                                                <li><input type="text" name="zhuyingchanpin[]" value="{{$item}}" placeholder="@if($key==0){{'请填写主营产品'}}@endif" /></li>
                                            @endforeach
                                        </ul>
                                    </div>
                                </div>
                            @endforeach

                        </div>
                        <div class="prompt_msg">
                            <span>每个空格限填1种产品名称</span>
                            <button class="addline1" type="button">+增加5个</button>
                        </div>
                    </div>
                   {{-- <div class="hang top">
                        <div class="noxname">客户群体</div>
                        <div class="nameright addcolumn3">
                            @foreach($customer_groups as $item_list)
                                <div class="lastt1">
                                    <div class="product05" style="float: left;">
                                        <ul>
                                            @foreach($item_list as $key => $item)
                                                <li><input type="text" name="kehuqunti[]" value="{{$item}}" placeholder="@if($key==0){{'请填写客户群体'}}@endif" /></li>
                                            @endforeach
                                        </ul>
                                    </div>

                                </div>
                            @endforeach
                        </div>
                        <div class="prompt_msg">
                            <span>每个空格限填1种客户类型</span>
                            <button class="addline2" type="button">+增加5个</button>
                        </div>
                    </div>--}}
                    <input type="hidden" name="kehuqunti[]" value=""/>
                    <div class="hang top" style="overflow: visible;">
                        <div class="name"><span class="red">*</span>销售区域</div>
                        <div class="nameright" style="position: relative;">
                            <div class="region" style="margin-left: -3px;">
                                <div class="regiontan" id="quyuxz">{{!empty($info['sales_region']) ? implode(',', json_decode($info['sales_region'],TRUE)) : ''}}</div>
                                <div class="selecttan">
                                    <div class="titlle">
                                        <span>请选择销售区域 最多只能选择8项目&nbsp;<label><input type="checkbox" value="全国" class="allxz xiaoshou "> 全国  </label></span>
                                        <span><img class="guanbi" src="{{asset('/img/web/user/guanbi.png')}}"></span>
                                    </div>
                                    <div class="left">
                                        @foreach($region_key as $key => $item)
                                            <li style="@if($key!='1') {{'border-top: 1px solid rgb(255, 255, 255)'}}@endif;">{{$item}}</li>
                                        @endforeach
                                    </div>
                                    <div class="right">
                                        @foreach($region_key as $key => $item)
                                            <li style="border-left: 1px solid rgb(255, 255, 255);">
                                                @foreach($regions as $region)
                                                    @if($region['area'] == $key)
                                                    <label><input type="checkbox" @if(!empty($info['sales_region']) and in_array($region['name'], json_decode($info['sales_region'],TRUE))){{'checked'}}@endif name="xiaoshouquyu[]" value="{{$region['name']}}" class="xiaoshou"> {{$region['name']}}  </label>
                                                    @endif
                                                @endforeach
                                            </li>
                                        @endforeach
                                    </div>
                                    <div class="clear"></div>
                                    <div class="queding">确定</div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="clear"></div>
                    <div class="hang top">
                        <div class="noxname">年营业额</div>
                        <div class="nameright">
                            <div class="namedt">
                                <?php $business_sum_arr = $info['business_sum'] ? $info['business_sum'] : [];?>
                                <span><input type="number" value="{{ !empty($business_sum_arr[0]) ? $business_sum_arr[0] : ''}}" name="nianyingyee" placeholder="请输入正整数" class="nyye" /></span>
                                <span>万元</span>
                                <span class="xuanze">
                                    <select name="bizhong">
                                        <option @if(!empty($business_sum_arr[1]) and $business_sum_arr[1]=='万人民币'){{'selected'}}@endif value="万人民币">万人民币</option>
                                        <option @if(!empty($business_sum_arr[1]) and $business_sum_arr[1]=='万美元'){{'selected'}}@endif value="万美元">万美元</option>
                                    </select>
                                </span>
                            </div>
                        </div>
                    </div>
                </div>

           {{--     <h3>采购信息</h3>
                <div class="content" style="min-height: auto">
                    <div class="hang top">
                        <div class="noxname">采购产品</div>
                        <div class="nameright addcolumn2">
                            @foreach($purchase_products as $item_list)
                                <div class="lastt2">
                                    <div class="product06" style="float: left;">
                                        <ul>
                                            @foreach($item_list as $key => $item)
                                                <li><input type="text" name="caigouchanpin[]" value="{{$item}}" placeholder="@if($key==0){{'请填写采购产品'}}@endif" /></li>
                                            @endforeach
                                        </ul>
                                    </div>

                                </div>
                            @endforeach
                       </div>
                       <div class="prompt_msg">
                            <span>每个空格限填1种产品名称.</span>
                            <button class="addline3" type="button">+增加5个</button>
                        </div>
                    </div>
                    <div class="hang top" style="overflow: visible;">
                        <div class="noxname">采购区域 </div>
                        <div class="nameright" style="position: relative;">
                            <div class="region">
                            <div class="regiontan01" id="quyuxz01">{{!empty($info['purchase_region']) ? implode(',', json_decode($info['purchase_region'],TRUE)) : ''}}</div>
                            <div class="selecttan01">
                                <div class="titlle"><span>请选择采购区域 最多只能选择8项目&nbsp;
                                <label><input type="checkbox" value="全国" class="allxz01"> 全国  </label></span><span><img class="guanbi01" src="{{asset('/img/web/user/guanbi.png')}}"></span>
                                </div>
                                <div class="left">
                                    @foreach($region_key as $key => $item)
                                        <li style="@if($key!='1') {{'border-top: 1px solid rgb(255, 255, 255)'}}@endif;">{{$item}}</li>
                                    @endforeach
                                </div>
                                <div class="right">
                                    @foreach($region_key as $key => $item)
                                        <li style="border-left: 1px solid rgb(255, 255, 255);">
                                            @foreach($regions as $region)
                                                @if($region['area'] == $key)
                                                    <label><input type="checkbox" @if(!empty($info['purchase_region']) and in_array($region['name'], json_decode($info['purchase_region'],TRUE))){{'checked'}}@endif name="caigouquyu[]" value="{{$region['name']}}" class="caigou"> {{$region['name']}}  </label>
                                                @endif
                                            @endforeach
                                        </li>
                                    @endforeach
                                </div>
                                <div class="clear"></div>
                                <div class="queding01">确定</div>
                            </div>
                            </div>

                        </div>
                    </div>
                    <div class="clear"></div>

                </div>--}}
                <input type="hidden" name="caigouchanpin[]" value=""/>
                <input type="hidden" name="caigouquyu[]" value="">

                <h3>公司展示</h3>
                <div class="content" style="min-height: auto">
                    <div class="hang top" style="position: relative;">
                        <div class="noxname"><span class="red">*</span>公司logo</div>
                        <div class="nameright">
                            <div class="img fl" id="js-photo-show">
                                <img src="{{!empty($info['ent_logo']) ? $info['ent_logo'] : asset('/img/web/user/file.png')}}" width="88" height="88" id="js-photo" />
                            </div>
                            <input type="file" class="fileupload" name="image" style="display:none" id="js-photo-upload" />
                            <input type="hidden" name="img_path" value="{{!empty($info['ent_logo']) ? $info['ent_logo'] : ''}}" />
                            <div class="prompt" style="color:#999;font-size: 12px;letter-spacing: 1px; margin-left: 108px; margin-top: 24px;"> 图片不超过2MB，尺寸不小于300*300像素，仅支持JPGJ、EPE、PNG、GIF格式。如果需要修改，请点击图片重新上传</div>
                        </div>
                    </div>

                    <div class="hang top">
                        <div class="noxname">服务标签</div>
                        <div class="nameright addcolumn4">
                            @foreach($ent_service_tag as $item_list)
                                <div class="lastt4">
                                    <div class="product02" style="float: left;">
                                        <ul>
                                            @foreach($item_list as $key => $item)
                                                <li><input type="text" name="fuwubiaoqian[]" placeholder="@if($key==0){{'请填写服务标签'}}@endif" value="{{$item}}" /></li>
                                            @endforeach
                                        </ul>
                                    </div>

                                </div>
                            @endforeach
                        </div>
                        <div class="prompt_msg">
                            <span>每个空格限填1个服务标签。如：免费包邮.</span>
                            <button class="addline4" type="button">+增加5个</button>
                        </div>
                    </div>
                    <div class="hang top">
                        <div class="noxname">公司理念</div>
                        <div class="nameright">
                            <input type="text" name="gongsilinian" class="gsln" value="{{!empty($info['ent_idea']) ? $info['ent_idea'] : ''}}" />
                        </div>
                    </div>
                    <div class="hang top">
                        <div class="noxname">公司简介</div>
                        <div class="nameright">
                            <textarea name="gongsijianjie" class="gsjj" maxlength="512">{{!empty($info['ent_intro']) ? $info['ent_intro'] : ''}}</textarea>
                        </div>
                    </div>
                </div>
                <div class="name">联系信息</div>
                <div class="content" style="min-height: auto">
                    <div class="hang top">
                        <div class="name"><span class="red">*</span>联&nbsp;系&nbsp;人</div>
                        <div class="nameright">
                            <input type="text" name="lianxiren" class="lxrxm" placeholder="请输入联系人姓名" value="{{!empty($info['contact_person']) ? $info['contact_person'] : ''}}" />
                        </div>
                    </div>

                    <div class="hang top">
                        <div class="noxname"><span class="red">*</span>性别</div>
                        <div class="nameright">
                            <label><input name="man" type="radio" value="1" class="radios" @if(!empty($info['contact_sex']) and $info['contact_sex']==1){{'checked'}}@endif /><span class="sex" >男</span> </label>
                            <label style="margin-left: 10px;"><input name="man" type="radio" value="0" class="radios" @if(isset($info['contact_sex']) and $info['contact_sex']==0){{'checked'}}@endif /><span class="sex" >女</span> </label>
                        </div>
                    </div>
                    <div class="hang top">
                        <div class="noxname">职位</div>
                        <div class="nameright">
                            <input type="text" name="zhiwei" class="lxrxm" placeholder="请输入联系人职位" value="{{!empty($info['contact_position']) ? $info['contact_position'] : ''}}" />
                        </div>
                    </div>
                    <div class="hang top">
                        <div class="name"><span class="red">*</span>手机号码</div>
                        <div class="nameright">
                            <input type="text" id="lxrnum" name="shoujihao" class="lxrxm" placeholder="请输入联系人手机号码" style="margin-left: -3px;" value="{{!empty($info['contact_mobile']) ? $info['contact_mobile'] : ''}}" />
                        </div>
                    </div>
                    <div class="hang top">
                        <div class="noxname">座机</div>
                        <div class="nameright">
                            <input type="text" name="quhao" class="lxrqh" value="@if($info['contact_tel']){{explode('-', $info['contact_tel'])[0]}}@endif">
                            <input type="text" name="zuoji" class="lxrnum" value="@if($info['contact_tel']){{explode('-', $info['contact_tel'])[1]}}@endif">
                        </div>
                    </div>
                    <div class="hang top">
                        <div class="noxname">传真</div>
                        <div class="nameright">
                            <input type="text" name="quhao1" class="lxrqh" value="@if($info['contact_fax']){{explode('-', $info['contact_fax'])[0]}}@endif" />
                            <input type="text" name="chuanzhen" class="lxrnum" value="@if($info['contact_fax']){{explode('-', $info['contact_fax'])[1]}}@endif" />
                        </div>
                    </div>
                    <div class="hang top" style="overflow: visible;">
                        <div class="noxname"><span class="red">*</span>联系地址</div>
                        <div class="nameright">
                            <div class="namedtlxdz">
                                <?php if(!empty($contact_address['regions'])){?>
                                    @include('web.layout.city', ['data' => implode('/', $contact_address['regions'])])
                                <?php }else{?>
                                    @include('web.layout.city', ['data' => ''])
                                <?php } ?>

                                <input type="text" name="namedtlxdz_addr" value="{{!empty($contact_address['addr']) ? $contact_address['addr'] : ''}}" placeholder="请输入详细地址" class="address">
                                <input type="hidden" name="namedtlxdz" value="@if($contact_address['regions']) {{implode(',', $contact_address['regions'])}} @endif" />
                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="hang top">
                        <div class="noxname">邮编</div>
                        <div class="nameright">
                            <input type="text" name="youbian" class="lxrnum" id="youbian" value="{{!empty($info['contact_postcode']) ? $info['contact_postcode'] : ''}}" />
                            <img src="" id="shangchuantp">
                        </div>
                    </div>
                </div>
                {!!  csrf_field() !!}

                <input type="submit" class="tijiao" value="保  存"  />
            </div>
            </form>
        </div>
    </div>
</div>
@if (count($errors) > 0)
    <script>
        {{--alert({{$v}});--}}
        layer.msg('您的信息已成功提交', {
          icon: 1,
          time: 2000 //2秒关闭（如果不配置，默认是3秒）
        }, function(){
            window.location.href='/member/seller/index';
        });

    </script>
@endif
@include('web.layout.footer')
</body>
</html>
<script src="{{mix('/js/web/inc/fileUpload.js')}}"></script>
<script>
    // 图片上传
    $('#js-photo-upload').change(function(){
        var url = AJAX_URL + '/uploads/images';
        var files =  this.files[0];
        var formFile = new FormData();
        formFile.append("image", files);
        // $.ajax({
        //     url: url,
        //     type: "POST",
        //     data: formFile,
        //     contentType: false,
        //     cache: false,
        //     processData: false,
        //     // 显示加载图片
        //     success: function (res) {
        //         if (res.status == 0){
        //             var img_path = '' + res.path;
        //             $("#js-photo").attr('src',res.path);
        //             $('input[name="img_path"]').val(res.path);
        //             layer.alert('图片上传成功', {
        //                 title:'提示',
        //                 icon: 1
        //             });
        //         } else {
        //             layer.alert('图片上传失败', {
        //                 title:'提示',
        //                 icon: 2
        //             });
        //         }
        //     },
        //     error: function () { }
        // });
        var cb=function(res){
            var img_path = '' + res.path;
            $("#js-photo").attr('src',res.path);
            $('input[name="img_path"]').val(res.path);
        }
        uploadFile(url,formFile,cb)
    })
    $("#js-photo").click(function () {
        $("#js-photo-upload").trigger("click");

    });
</script>